import Taro, { Component } from '@tarojs/taro';
import { View, Image } from '@tarojs/components';

import './index.scss';


/**
 *
 * @param {string} avatar 卡号
 * @param {string} nickname 规格或者兑换对歌
 * @param {number} agencyId id
 * @param {string} level 等级
 */
function UserBox({ avatar, nickname, agencyId, level }) {

  function watchAgencyPerformance() {
    Taro.navigateTo({
      url: `/subPackageWork/pages/agency-performance/index?id=${agencyId}&nickname=${nickname}`
    })
  }

    return (
      <View className="user-item">
        <Image src={avatar} alt="头像" className="avatar" />
        <View className="msg">
          <View className="nickname">{nickname}</View>
          <View className="level">{level}</View>
        </View>
        <View className="space"></View>
        <View className="watch-btn" onClick={watchAgencyPerformance}>查看记录</View>
      </View>
    )
}

export default UserBox;
